﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/Adminitrator.master"
  AutoEventWireup="true" CodeFile="List.aspx.cs" Inherits="admin_Categories_List" %>

<asp:Content ID="Content2" ContentPlaceHolderID="Content" runat="Server">
   <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
     <asp:UpdatePanel ID="UpdatePanel1" runat="server">
      <ContentTemplate>  
  <h1 class="title">
    Danh sách danh mục bài viết</h1>
  <div class="search">
    <fieldset class="fieldset">
      <legend>Lọc hiển thị</legend>
      <table width="100%">
        <tr>
          <td style="width: 265px">
            <label>
              Danh mục cha</label>
            <asp:DropDownList ID="dropParent" runat="server" CssClass="dropDown" AutoPostBack="True"
              OnSelectedIndexChanged="dropParent_SelectedIndexChanged" Width="190px" />
          </td>
          <td align="left">
            <label>
              Tình trạng</label>
            <asp:DropDownList ID="dropIsEnable" runat="server" CssClass="dropDown" Width="70px"
              AutoPostBack="True" OnSelectedIndexChanged="dropIsEnable_SelectedIndexChanged">
              <asp:ListItem Value="0">Tất cả</asp:ListItem>
              <asp:ListItem Value="1">Bật</asp:ListItem>
              <asp:ListItem Value="2">Tắt</asp:ListItem>
            </asp:DropDownList>
          </td>
        </tr>
      </table>
      </fieldset>
  </div> 
  <div id="gridview">
    <asp:GridView ID="gridView" CssClass="tstyle1" runat="server" AutoGenerateColumns="False"
      CellPadding="3" EnableModelValidation="True" GridLines="None" AllowPaging="True"
      BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellSpacing="1"
      OnRowDataBound="gridView_RowDataBound" OnPageIndexChanging="gridView_PageIndexChanging"
      PageSize="8" OnRowDeleting="gridView_RowDeleting" 
      EmptyDataText="Dữ liệu trống !" onrowcommand="gridView_RowCommand">
      
      <SelectedRowStyle BackColor="#990000" Font-Bold="True" ForeColor="White" Font-Underline="True" />
      <Columns>
       <asp:TemplateField HeaderText="STT">
          <ItemTemplate>
            <%# Container.DataItemIndex + 1 %>
          </ItemTemplate>
          <ItemStyle Width="40px" />
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Chọn">
          <ItemTemplate>
            <asp:CheckBox ID="checkBox" runat="server" />
          </ItemTemplate>
          <ItemStyle Width="45px" />
        </asp:TemplateField>
        <asp:BoundField DataField="Id" HeaderText="ID">
          <ItemStyle Width="35px" />
        </asp:BoundField>
        <asp:BoundField DataField="Name" HeaderText="Name">
          <ItemStyle Width="330px" />
        </asp:BoundField>
        <asp:BoundField DataField="Parent" HeaderText="Danh mục cha">
          <ItemStyle Width="120px" />
        </asp:BoundField>
        <asp:ButtonField CommandName="Down" ImageUrl="~/Images/icon-down.png">
          <ItemStyle Width="25px" CssClass="linkDown" />
        </asp:ButtonField>
        <asp:ButtonField ImageUrl="~/Images/icon-up.png" CommandName="Up">
          <ItemStyle Width="25px" CssClass="linkUp" />
        </asp:ButtonField>
        <asp:ImageField DataImageUrlField="Image" DataImageUrlFormatString="~/Images/Category/{0}"
          HeaderText="Ảnh">
          <ControlStyle Height="30px" />
          <HeaderStyle HorizontalAlign="Center" />
          <ItemStyle HorizontalAlign="Center" Width="50px" />
        </asp:ImageField>
        <asp:TemplateField HeaderText="Tình trạng">
          <ItemTemplate>
            <asp:Image ID="imgStates" runat="server" />
          </ItemTemplate>
          <ItemStyle Width="80px" />
        </asp:TemplateField>
        <asp:HyperLinkField DataNavigateUrlFields="Id" DataNavigateUrlFormatString="~/admin/Categories/Details.aspx?Id={0}"
          HeaderText="Sửa">
          <ItemStyle CssClass="btnEdit" Width="30px" />
        </asp:HyperLinkField>
        <asp:TemplateField HeaderText="Xóa">
          <ItemTemplate>
            <asp:LinkButton ID="linkDelete" runat="server" CausesValidation="false" Text="" CssClass="btnDelete"
              CommandName="Delete" OnClientClick="return confirm('Danh mục con và bài viết trong danh mục này sẽ bị xóa ! Bạn có chắc chắn muốn xóa ?')">
            </asp:LinkButton>
          </ItemTemplate>
          <ItemStyle Width="30px" />
        </asp:TemplateField>
      </Columns>
    </asp:GridView>
      <asp:UpdateProgress ID="UpdateProgress1" runat="server">
          <ProgressTemplate>
              <img src="../../Images/ajax-loader.gif" alt="Loadding" style="position: absolute; top: 50%; left: 50%; z-index: 1000" />
          </ProgressTemplate>
        </asp:UpdateProgress>
  </div>
  <!-- End #gridView -->
  <div>
    <table style="width: 100%">
      <tr>
        <td align="left" valign="top">
          <asp:LinkButton ID="LinkButton1" runat="server" Text="" CssClass="button btn-check"
            OnClick="linkCheckAll_Click" />&nbsp; &nbsp; &nbsp;
          <asp:LinkButton ID="LinkButton2" runat="server" Text="" CssClass="button btn-uncheck"
            OnClick="linkUnCheckAll_Click" />
        </td>
        <td align="right">
          <asp:Button runat="server" ID="btnAdd" Text="" CssClass="button btn-add" OnClick="btnAdd_Click" />&nbsp;
          <asp:Button runat="server" ID="btnXoaChon" Text="" CssClass="button btn-delete" OnClientClick="return confirm('Bạn có chắc chắn muốn xóa ?')"
            OnClick="btnXoaChon_Click" />
          &nbsp;
          <asp:Button runat="server" ID="btnEnable" Text="" CssClass="button btn-show" OnClick="btnEnable_Click" />&nbsp;
          <asp:Button runat="server" ID="btnVisible" Text="" CssClass="button btn-hidden" OnClick="btnVisible_Click" />
        </td>
      </tr>
    </table>
  </div>
  <div style="margin: 10px 0px">
    <label>
      Số dòng hiển thị trên 1 trang :
    </label>
    <asp:DropDownList runat="server" ID="dropPageSize" CssClass="dropdown" AutoPostBack="true"
      OnSelectedIndexChanged="dropCountRow_SelectedIndexChanged">
      <asp:ListItem Text=" 10 " Value="10" />
      <asp:ListItem Text=" 20 " Value="20" Selected="True" />
      <asp:ListItem Text=" 30 " Value="30" />
      <asp:ListItem Text=" 50 " Value="50" />
      <asp:ListItem Text=" 100 " Value="100" />
    </asp:DropDownList>
  </div>
  <div style="margin-top: 10px">
    <asp:Literal ID="lbThongBao" runat="server" />
  </div>
           </ContentTemplate> 
    </asp:UpdatePanel>
</asp:Content>
